import axios from "axios";
const port = process.env.PORT || 5000;
// console.log(port)
const service = axios.create({
  // baseURL: process.env.VUE_APP_BASE_API,
  baseURL: `http://127.0.0.1:${port}/`,
  timeout: 30000,
});
/**
 * 请求拦截
 */
service.interceptors.request.use(
  config => {
    return config;
  },
  error => {
    return Promise.reject(error);
  }
);
/**
 * 响应拦截
 */
service.interceptors.response.use(
  response => {
    const res = response.data;
    return res;
  },
  error => {
    return Promise.reject(error);
  }
);

export default service;